home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Auge 4000 / Auge 4000 #17 (1988-04-01)(Amiga User Gruppe Einzugsgebiet 4000).zip / Auge 4000 #17 (1988-04-01)(Amiga User Gruppe Einzugsgebiet 4000).adf / DrunkenMouse / inputhandler.c < prev    next >
C/C++ Source or Header  |  1996-12-24  |  1KB  |  69 lines

  1. /* inputhandler.c */
  2. #include <exec/types.h>
  3. #include <exec/ports.h>
  4. #include <exec/memory.h>
  5. #include <exec/tasks.h>
  6. #include <devices/input.h>
  7. #include <devices/inputevent.h>
  8. #include <intuition/intuitionbase.h>
  9.  
  10. /* ====  EXPORT  ==== */
  11. extern struct InputEvent *InputHandler();
  12. extern struct IntuitionBase *IntuitionBase;
  13. /*****/
  14.  
  15. /* ==== IMPORT ===== */
  16. extern APTR MyTask;
  17. extern ULONG INPUTEVENT;
  18. extern SHORT PosX,PosY;
  19. /***/
  20.  
  21.  
  22. struct InputEvent 
  23. *InputHandler(ev, data)
  24.    struct InputEvent *ev;
  25.    struct MemEntry *data[];
  26.  
  27. {
  28.    struct InputEvent *curr;
  29.  
  30.    curr = ev;
  31.    while(curr)
  32.    {
  33.  
  34.       switch(curr->ie_Class)
  35.       {
  36.          case IECLASS_POINTERPOS:
  37.          case IECLASS_RAWMOUSE:
  38.             PosX = IntuitionBase->MouseX;
  39.             PosY = IntuitionBase->MouseY;
  40.             Signal(MyTask,INPUTEVENT);
  41.             break;
  42.          default:
  43.             break;
  44.       }
  45. /*
  46.       if (curr->ie_Class==IECLASS_POINTERPOS)
  47.       {
  48.          PosX = curr->ie_X;
  49.          PosY = curr->ie_Y;
  50.          Signal(MyTask,INPUTEVENT);
  51.  
  52.       }
  53.       else if (curr->ie_Class==IECLASS_RAWMOUSE)
  54.       {
  55.          if (curr->ie_Code==IECODE_NOBUTTON)
  56.          {
  57.             PosX += curr->ie_X;
  58.             PosY += curr->ie_Y;
  59.             Signal(MyTask,INPUTEVENT);
  60.          }
  61.       }
  62.  
  63. */
  64.       curr=curr->ie_NextEvent;
  65.    }
  66.    return(ev);
  67. }
  68.  
  69.